﻿using System;
using System.Collections.Generic;
using System.Web;

namespace Ecreate.Web.usercontrol
{
    public class GG
    {
        public static System.Data.DataTable GetTable(string sql)
        {
            return Ecreate.Data.FactoryDBEngine.GetInstance().GetDataTable(sql);
        }

        public static int ExecSql(string sql)
        {
            return Ecreate.Data.FactoryDBEngine.GetInstance().ExecuteNonQuery(sql);
        }

        public static void Alert(System.Web.UI.Page page, string message)
        {
            page.Response.Write("<script type=\"text/javascript\" language=\"javascript\">        alert('" + message + "');　; </script>");
        }

        public static void AlertAndRedirect(System.Web.UI.Page page, string message, string url)
        {
            page.Response.Write("<script type=\"text/javascript\" language=\"javascript\">alert('" + message + "');window.location.href=\"" + url + "\";</script>");
        }

        public static void AlertAndRedirectChild(System.Web.UI.Page page, string message, string url)
        {
            page.Response.Write("<script type=\"text/javascript\" language=\"javascript\">alert('" + message + "');window.parent.frames[\"contentIframe\"].location=\"" + url + "\";</script>");
        }
    }
}
